export default function addTreeNodes(treeData, nodes) {
  // const children = 'children';
  if (nodes) {
    for (node of nodes) {
      addTreeNode(treeData, node);
    }
  }
}

function addTreeNode(treeData, node) {
  for (treeItem of treeData) {
    if (node.parentId === treeData.value) {
      if (!treeItem.children) {
        treeItem.children = [];
      }
      treeItem.children.push(node);
      break;
    }else if (treeItem.children) {
      addTreeNode(treeItem.children, node);
    }
  }
}